export class Shape{
    area : number;
    color : string;
    //构造函数
    constructor(public name: string, public width: number, public height: number){
        this.area = width * height;
        this.color = "pink";
    };
    //方法：自我描述
    shoutOut() {
        return "I'm " + this.color + " " + this.name +  " with an area of " + this.area + " cm squared.";
    }
}

var square = new Shape("lwyfish", 30, 30);
setTimeout(() => {
    console.log(square.shoutOut());
    console.log("area of shape: "+square.area);
    console.log("name of shape: "+square.name);
    console.log("color of shape: "+square.color);
    console.log("width of shape: "+square.width);
    console.log("height of shape: "+square.height);
}, 10000);

